//
//  LzwSeachEndTableCell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/12.
//  Copyright © 2016年 刘志武. All rights reserved.
//


#import "LzwSeachEndTableCell.h"
#import "UIImageView+WebCache.h"
#import "LzwBaseImageView.h"
#import "LzwBaseLable.h"

@interface LzwSeachEndTableCell ()

@property (nonatomic, retain) LzwBaseImageView *myImageView;
@property (nonatomic, retain) LzwBaseLable *myLable;
@property (nonatomic, retain) LzwBaseLable *myLable1;
@property (nonatomic, retain) LzwBaseImageView *myImageView1;

@property (nonatomic, retain) LzwBaseImageView *myImageView2;
@property (nonatomic, retain) LzwBaseLable *myLable2;
@property (nonatomic, retain) LzwBaseLable *myLable3;

@end



@implementation LzwSeachEndTableCell

-(void)dealloc{
    [_myImageView release];
    [_myLable release];
    [_myImageView1 release];
    [_myLable1 release];
    [_myLable2 release];
    [_myImageView2 release];
    [_myLable3 release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creats];
    }
    return self;
}

- (void)creats{
    
    //大图片
    self.myImageView = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(5 * WIDTH, 10 * WIDTH, 140 * WIDTH, 160 * WIDTH)];
//    self.myImageView.layer.masksToBounds = YES;
//    self.myImageView.layer.cornerRadius = 20;
    [self.contentView addSubview:self.myImageView];
    
    //图片姓名
    self.myLable = [[LzwBaseLable alloc]initWithFrame:CGRectMake(150 * WIDTH, 10 * WIDTH, 200 * WIDTH, 20 * WIDTH)];
    self.myLable.textColor = [UIColor lightGrayColor];
    self.myLable.font = [UIFont systemFontOfSize:14 * WIDTH];
    [self.contentView addSubview:self.myLable];
    
    //价格图片
    self.myImageView1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(150 * WIDTH, 40 * WIDTH, 15 * WIDTH, 15 * WIDTH)];
    self.myImageView1.image = [UIImage imageNamed:@"jiage.png"];
    [self.contentView addSubview:self.myImageView1];
    
    //价钱
    self.myLable1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake(170 * WIDTH, 37 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myLable1.font = [UIFont systemFontOfSize:14 * WIDTH];
    self.myLable1.textColor = [UIColor redColor];
    [self.contentView addSubview:self.myLable1];
    
    //小图片
    self.myImageView2 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(170 * WIDTH, 60 * WIDTH, 30 * WIDTH, 30 * WIDTH)];
    self.myImageView2.layer.masksToBounds = YES;
    self.myImageView2.layer.cornerRadius = 15 * WIDTH;
    [self.contentView addSubview:self.myImageView2];
    
    //人物名字
    self.myLable2 = [[LzwBaseLable alloc]initWithFrame:CGRectMake(210 * WIDTH, 65 * WIDTH, 50 * WIDTH, 20 * WIDTH)];
    self.myLable2.font = [UIFont systemFontOfSize:14 * WIDTH];
    self.myLable2.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.myLable2];
    
    //产品描述
    self.myLable3 = [[LzwBaseLable alloc]initWithFrame:CGRectMake(150 * WIDTH, 100 * WIDTH, 220 * WIDTH, 70 * WIDTH)];
    self.myLable3.numberOfLines = 0;
    self.myLable3.textColor = [UIColor lightGrayColor];
    self.myLable3.font = [UIFont systemFontOfSize:14 * WIDTH];
    [self.contentView addSubview:self.myLable3];
    
    [_myImageView release];
    [_myImageView1 release];
    [_myImageView2 release];
    [_myLable release];
    [_myLable1 release];
    [_myLable2 release];
    [_myLable3 release];
    
    
}

-(void)setModleS:(LzwAdressSeachEndModle *)modleS{
    
    if (_modleS != modleS) {
        [_modleS release];
        _modleS = [modleS retain];
    }
    
    NSURL *url = [NSURL URLWithString:self.modleS.pic];
    
    [self.myImageView sd_setImageWithURL:url placeholderImage:nil];
    
    self.myLable.text = self.modleS.title;
    self.myLable1.text = self.modleS.price;
    
    NSURL *url1 = [NSURL URLWithString:[self.modleS.user objectForKey:@"avatar"]];
    [self.myImageView2 sd_setImageWithURL:url1 placeholderImage:nil];
    
    self.myLable2.text = [self.modleS.user objectForKey:@"username"];
    
    self.myLable3.text = self.modleS.desc;
    
}

@end




